$(document).ready(function() {
	$("#gaoliang39").removeClass("sub-menu-link").addClass("selected");

	$.formValidator.initConfig({
		validatorGroup : "1",
		formID : "payForm",
		onerror : function(input1, input2) {
			return false;
		}
	});

	
	
	$('#submitBtn').click(function(){
		
		if ($.formValidator.pageIsValid("1")) {
			
			var data = {};
			$("#payForm").serializeArray().map(function(x){data[x.name] = x.value;});
			
			var url = ctx + "/expay/apiConfirmSubmit.do";

			$.ajax({  
			     type:'post',  
			     url: url,  
			     data: data,  
			     dataType:'json',  
			     success:function(result){  
			    	 if (result.respCode == '0000') {
					        ///跳转等待页面
			    		    var href  = ctx + "/expay/payWait.do?orderId=" + $("#orderId").val();;
			    		    $('#openWait').parents('a').attr('href', href);
			    		    $('#openWait').click();
			    	 
			    	 } else {
							alert("确认支付失败");
						}
						$('#retMsg').val(result.xml);
			      },  
			      error:function(){alert('服务器异常');}  
			});
			
			
		}	
	});
});


